package com.atguigu.srb.sms.controller;

import com.atguigu.srb.base.util.Asserts;
import com.atguigu.srb.common.result.R;
import com.atguigu.srb.common.result.ResponseEnum;
import com.atguigu.srb.sms.service.SmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.internal.org.objectweb.asm.Handle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description:
 * @Author: Gavin
 * @Date: 7/5/2023 8:38 PM
 */
@RestController
@RequestMapping("/api/sms")
@Api(tags = "短信模块")
//开启跨域
// @CrossOrigin
public class SmsController {
    @Autowired
    SmsService smsService;
    /**
     * 需要接受的参数有 手机号码 以及 业务类型
     * type  1 注册短信  2 登录短信  3 充值短信  4 提现短信
     */
    @ApiOperation("短信发送业务,type  1 注册短信  2 登录短信  3 充值短信  4 提现短信")
    @GetMapping("/{phone}/{type}")
    public R sendMsg(@PathVariable("phone")String phone,
                     @PathVariable("type")Integer type){
        //准备一个空的map,占位用
        Map<String,Object> map = new HashMap<>();
        smsService.sendMsg(phone,type,map);

        return R.ok();
    }
}
